﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlSetSKUForTDVStep2.ascx.cs" Inherits="UserControl_ControlSetSKUForTDVStep2" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<script type="text/javascript">


    var allCheckBoxSelector = '#<%=grvProduct.ClientID%> input[id*="CheckAll"]:checkbox';
    var checkBoxSelector = '#<%=grvProduct.ClientID%> input[id*="CheckApprove"]:checkbox';

    function ToggleCheckUncheckAllOptionAsNeeded() {
        var totalCheckboxes = $(checkBoxSelector),
         checkedCheckboxes = totalCheckboxes.filter(":checked"),
         noCheckboxesAreChecked = (checkedCheckboxes.length === 0),
         allCheckboxesAreChecked = (totalCheckboxes.length === checkedCheckboxes.length);

        $(allCheckBoxSelector).attr('checked', allCheckboxesAreChecked);
    }


    function pageLoad() {




        $(allCheckBoxSelector).live('click', function () {
            $(checkBoxSelector).attr('checked', $(this).is(':checked'));

            ToggleCheckUncheckAllOptionAsNeeded();
        });

        $(checkBoxSelector).live('click', ToggleCheckUncheckAllOptionAsNeeded);

        ToggleCheckUncheckAllOptionAsNeeded();


      
       
    $("#<%= imgBtnBack.ClientID %>").click(function () {
        $.blockUI({
            message: '<h1>Xin vui lòng chờ xử lý</h1>',
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
    });
    $("#<%= ImgBtnNext.ClientID %>").click(function () {
        $.blockUI({
            message: '<h1>Xin vui lòng chờ xử lý</h1>',
        css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
        });
    });
    $("#<%= imgBtnDelete.ClientID %>").click(function () {
        $.blockUI({
            message: '<h1>Xin vui lòng chờ xử lý</h1>',
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

    $("#<%= imgBtnSave.ClientID %>").click(function () {
        $.blockUI({
            message: '<h1>Xin vui lòng chờ xử lý</h1>',
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
  

           <div class="direct_container_right_titletop direct_colleft">
            Phân mặt hàng cho TDV
        </div>
       
       <!-- Button chuc nang-->
                <div class="direct_menu_report_page direct_colleft">
             
             <asp:ImageButton ID="imgBtnSave" ToolTip="Lưu thông tin đã phân SKU cho TDV" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />
             <asp:ImageButton ID="imgBtnDelete" ToolTip="Xóa thông tin đã phân SKU cho TDV" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
             <asp:ImageButton ID="imgBtnBack" ToolTip="Quay lại màn hình chọn TDV" onclick="imgBtnBack_Click"  ImageUrl="~/Images/Arrow-Right.png" Width="32px" Height="32px" runat="server" />
             <asp:ImageButton ID="ImgBtnNext"  ToolTip="Tiếp tục phân khách hàng cho TDV này" onclick="ImgBtnNext_Click"  ImageUrl="~/Images/Arrow-Left.png" Width="32px" Height="32px" runat="server" />
</div>
  <div class="clear"></div>
                 <hr />
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial" 
            Width="100%">
             <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Thông tin sản phẩm" TabIndex="0">
                 <ContentTemplate>
        <div class="direct_container_form_right">
         <table border="0" width="100%">
                         <tr>
                            <td colspan="2">
                               Bước 2:Check chọn mặt hàng(SKU) cho trình dược viên : 
                                <asp:Label ID="lblTDV" runat="server" Text=""></asp:Label>
                            </td>
                        </tr>
                        <tr>
                        <td>
                             <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                       
                                        
                                         DataKeyNames="itemkey" EnableModelValidation="True">
                                         <Columns>
                           
                            <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
   <asp:TemplateField HeaderText="Gam hàng"><HeaderTemplate>
                                                                    Gam hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblGroup" runat="server" Text='<%# Eval("Group")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Nhóm sản phẩm"><HeaderTemplate>
                                                                    Nhóm sản phẩm
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblChannel" runat="server" Text='<%# Eval("Channel")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã mặt hàng(SKU)"><HeaderTemplate>
                                                                    Mã mặt hàng(SKU)
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblitemkey" runat="server" Text='<%# Eval("itemkey")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên hàng"><HeaderTemplate>
                                                                    Tên hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
                         
                           
 <asp:TemplateField HeaderText="">
                <HeaderTemplate>
                    <asp:CheckBox ID="CheckAll" runat="server"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckApprove" Checked='<%# Eval("isSet")%>' runat="server" />
                </ItemTemplate>
            
                        
            </asp:TemplateField>

</Columns>
</asp:GridView>
                        </td>
                        </tr>
        </table>
        
        </div>
                 </ContentTemplate>
        </cc1:TabPanel>
         <cc1:TabPanel ID="TabPanel2"  runat="server" HeaderText="Sản phẩm trùng" TabIndex="1">
                 <ContentTemplate>
                         <!-- Content main-->
                                    <div class="direct_container_main">
                                        <div class="direct_container_form_right">
                                            <table border="0" width="100%">
                                            
                                                <tr>
                                                    <td colspan="2" align="center">
                                                       <asp:Label Font-Bold="true" ID="Label1" runat="server" Text="Danh sách trình dược viên khác được phân tuyến cho sản phẩm và khách hàng mà bạn vừa chọn"></asp:Label>
                                                       
                                                    </td>
                                                </tr>
                                               
                                                  
                                               <tr>
                                                    <td colspan="2">
                                                    <asp:GridView ID="grvDup" runat="server" AutoGenerateColumns="False" 
                                        
                                         EnableModelValidation="True">
                                         <Columns>
                           
                            <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã TDV"><HeaderTemplate>
                                                                    Mã TDV
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblSalesPKey" runat="server" Text='<%# Eval("SalesPKey")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Họ tên TDV"><HeaderTemplate>
                                                                    Họ tên TDV
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblsalesp_name" runat="server" Text='<%# Eval("salesp_name")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="250px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="250px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã khách hàng"><HeaderTemplate>
                                                                   Mã khách hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblCustKey" runat="server" Text='<%# Eval("CustKey")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên khách hàng"><HeaderTemplate>
                                                                  Tên khách hàng
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblcustomer_name" runat="server" Text='<%# Eval("customer_name")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="250px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="250px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Địa chỉ"><HeaderTemplate>
                                                                  Địa chỉ
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lbladdress" runat="server" Text='<%# Eval("address")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="250px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="250px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã hàng"><HeaderTemplate>
                                                                  Mã hàng
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblItemkey" runat="server" Text='<%# Eval("Itemkey")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên mặt hàng"><HeaderTemplate>
                                                                  Tên mặt hàng
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="250px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="250px" />
</asp:TemplateField>

</Columns>
</asp:GridView>
                                                    </td>
                                               </tr>
                                                
                                               
                                            </table>
                                        </div>
                                    </div>
                                    <!-- EndContent main-->
                               
                 </ContentTemplate>
        </cc1:TabPanel>
          </cc1:TabContainer>

         <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
      </ContentTemplate>
 </asp:UpdatePanel>